c84328
@@ -29,6 +29,7 @@
import java.io.StringReader;
 import java.net.URL;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -368,6 +369,9 @@
public final class CSVParser implements Iterable<CSVRecord>, Closeable {
             // build the name to index mappings
             if (header != null) {
                 for (int i = 0; i < header.length; i++) {
+                    if (hdrMap.containsKey(header[i])) {
+                        throw new IllegalStateException("The header contains duplicate names: " + Arrays.toString(header));
+                    }
                     hdrMap.put(header[i], Integer.valueOf(i));
                 }
             }
